From: Dale Wijnand Date: Tue, 10 Apr 2018 07:22:29 +0000 (+0100) Subject: Move edition earlier in TomlManifest::to_real_manifest X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~52^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=6828380e5682c3ee3013a5e44844957c686a4efa;p=cargo.git Move edition earlier in TomlManifest::to_real_manifest and fix a typo in the error message --- diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 7f20e979b..bb9fb7b4d 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -633,6 +633,19 @@ impl TomlManifest { let pkgid = project.to_package_id(source_id)?; + let edition = if let Some(ref edition) = project.rust { + features + .require(Feature::edition()) + .chain_err(|| "editions are unstable")?; + if let Ok(edition) = edition.parse() { + edition + } else { + bail!("the `rust` key must be one of: `2015`, `2018`") + } + } else { + Edition::Edition2015 + }; + // If we have no lib at all, use the inferred lib if available // If we have a lib with a path, we're done // If we have a lib with no path, use the inferred lib or_else package name @@ -798,18 +811,6 @@ impl TomlManifest { None => false, }; - let edition = if let Some(ref edition) = project.rust { - features - .require(Feature::edition()) - .chain_err(|| "editiones are unstable")?; - if let Ok(edition) = edition.parse() { - edition - } else { - bail!("the `rust` key must be one of: `2015`, `2018`") - } - } else { - Edition::Edition2015 - }; let custom_metadata = project.metadata.clone(); let mut manifest = Manifest::new( summary, diff --git a/tests/testsuite/package.rs b/tests/testsuite/package.rs index 20e6821d3..0a9845a20 100644 --- a/tests/testsuite/package.rs +++ b/tests/testsuite/package.rs @@ -1220,7 +1220,7 @@ fn test_edition_nightly() { error: failed to parse manifest at `[..]` Caused by: - editiones are unstable + editions are unstable Caused by: feature `edition` is required